package com.lapian.designmode.flyweight.test;

import java.util.HashMap;

public class DouLuoDaLuFactoryC {
    HashMap<String,ConcreteRoleC> pool=new HashMap<>();
    public AbstractRoleC get(String type) {
        if (!pool.containsKey(type)) {
            pool.put(type,new ConcreteRoleC(type));
        }
        return (AbstractRoleC)pool.get(type);
    }
    public void typeSize() {
        System.out.println("多少种类型："+pool.size());
    }
}
